package com.investmenttechnologyservices.services;

import java.util.Currency;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;
import com.investmenttechnologyservices.model.StageType;
import com.investmenttechnologyservices.model.Trade;

public interface TradeService {
	
	void findAll(HttpServletRequest req, HttpServletResponse res) throws Exception;
	
	Map<String,Object> find(HttpServletRequest req, HttpServletResponse res) throws ServletException;
	
	void stageTypePicker(HttpServletRequest req, HttpServletResponse res) throws ServletException;

	void create(HttpServletRequest req, HttpServletResponse res) throws ServletException;

	List<Entity> getTradesForAccount(Key accountKey);
	
	Trade cloneTrade(Trade trade, Boolean reverse, Boolean zero);
	
	List<Key> createNewTransaction(String instrumentId, String symbolId, Long accountId, Double quantity,
			Double price, Date tradeDate, List<String> tags);

	List<Key> initTrade(String instrumentId, String symbolId, Long accountId, Double quantity,
			Double price, Date tradeDate, List<String> tags, StageType stageType);

	List<Key> createNewTrade(String instrumentId, String symbolId, Long accountId, Double quantity,
			Double price, Date tradeDate, List<String> tags, StageType stageType);
	
	List<Key> createNewCashTrade(Currency currency, Long accountId, Key instrumentTradeKey, Double quantity, 
			Date tradeDate, Date settlementDate, List<String> tags, StageType stageType);

	List<Key> modifyTrade(Key tradeKey, Double quantity,Double price, Date tradeDate, List<String> tags);

	List<Key> cancelTrade(Key tradeKey);
	
	List<Key> executeOrder(Key tradeKey, Double quantity, Double price, Date tradeDate);

}
